home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung CD 2 (Tewi)(1994).iso
/
c
/
compiler
/
small_c
/
byte_sc
/
freopen.c
< prev
next >
Wrap
Text File
|
1987-10-04
|
768b
|
20 lines
#define NOCCARGC /* no argument count passing */
#include stdio.h
/*
** Close previously opened fd and reopen it.
** Entry: fn = Null-terminated CP/M file name.
** May be prefixed by letter of drive.
** May be just CON:, RDR:, PUN:, or LST:.
** mode = "a" - append
** "r" - read
** "w" - write
** "u" - update
** fd = File descriptor of pertinent file.
** Returns the original fd on success, else NULL.
*/
freopen(fn, mode, fd) char *fn, *mode; int fd; {
if(fclose(fd)) return (NULL);
if((fd=Uopen(fn, mode, fd))==ERR) return (NULL);
return (fd);
}